package gof23.structure.facade;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import javax.servlet.http.HttpServletRequest;

import org.apache.catalina.connector.Connector;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.RequestFacade;
import org.apache.ibatis.builder.xml.XMLConfigBuilder;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.defaults.DefaultSqlSessionFactory;

public class JDKFacadeDemo {

	public static void main(String[] args) throws Exception {
		HttpServletRequest httpServletRequest = new RequestFacade(new Request(new Connector()));
		
		//Builder模式
		XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(new FileInputStream("") );
		Configuration configuration = xmlConfigBuilder.getConfiguration();
		//工厂模式
		SqlSessionFactory sqlSessionFactory =  new DefaultSqlSessionFactory(configuration);
		SqlSession session =   sqlSessionFactory.openSession();
		
		session.select("", null);
		session.insert("");
		System.out.println();
	}
}
